package com.example.gateway.designPattern.chainOfResponsibility;

/**
 * @ClassName: AbsLogger
 * @Description:
 * @Author: YourName
 * @Date: 2025/1/6
 */

public abstract class AbsLogger {

    public static int INFO = 1;
    public static int DEBUG = 2;
    public static int ERROR = 3;

    protected int level;

    protected AbsLogger nextLogger;

    public void setNextLogger(AbsLogger nextLogger) {
        this.nextLogger = nextLogger;
    }

    public void logMessage(int level, String message) {
        if (this.level <= level) {
            System.out.println("current=======");
            write(message);
        }
        if (nextLogger != null) {
            nextLogger.logMessage(level, message);
        }
    }
    abstract protected void write(String message);
}
